clear
rng default
%% Load useful matrices
load PYX_cond 
load U_CS

%% Construct grid of parameters to check 
gran=0.1;
u01grid=0; %location normalisation [Ychosen=0, X=1]
u02grid=0; %location normalisation
u11grid=U_11_CS; %scale normalisation
u12grid= -10:gran:10;
u22grid= -10:gran:10; 
u21grid= -10:gran:10; 
% try different values of gran and different sizes of grid hypercube as discussed in Appendix C of the paper (need powerful cluster to run the code for higher values of gran and larger sizes of hypercube)
[ca, cb, cc, cd, ce, cf] = ndgrid(u01grid, u11grid, u21grid, u02grid, u12grid, u22grid);
u01grid=ca(:);
u11grid=cb(:);
u21grid=cc(:);
u02grid=cd(:);
u12grid=ce(:);
u22grid=cf(:);

%% Jobs
workers=500; %number of parallel workers
jobs=round(size(u12grid,1)/workers); %number of jobs per parallel worker